import { pget, ppostJson, postFileByFormData } from '@/utils/req'
import { modalApi } from '@/utils/modalReq'

// 车辆列表
export function getTableList(query: any) {
	return pget(`${modalApi.carMessage}/vehicle/page`, query)
}

// 车辆列表
// export function getTableList(query: any) {
// 	if (window.apiPrefixUri) {
// 		return pget(`${window.apiPrefixUri}/mgrApi/car/car/mis/manage/page`, query)
// 	}
// 	return pget(`${modalApi.carMessage}/vehicle/page`, query)
// }

// 品牌车型车系
export function getXZCarTypeList() {
	return pget(`${modalApi.carMessage}/supplycarfashion/list`)
}

// 品牌车型车系
export function getCarTypeList(query?: any) {
	if (window.apiPrefixUri) {
		return pget(`${window.apiPrefixUri}/mgrApi/car/car/base/fashion/list/v1`, query)
	}
	return pget(`${modalApi.carMessage}/supplycarfashion/list`)
}

// 编辑车辆列表
export function editList(data: any) {
	return ppostJson(`${modalApi.carMessage}/vehicle/update`, data)
}

// 查看车辆列表
export function viewList(query: any) {
	return pget(`${modalApi.carMessage}/vehicle/detail`, query)
}

// 批量车辆导入检查
export const importCheck = `${modalApi.carMessage}/vehicle/import/check`

// 批量车辆导入提交
export function importSave(data: any) {
	return postFileByFormData(`${modalApi.carMessage}/vehicle/import`, data)
}

// 批量车辆导入错误列表
export function getErrorList(query?: any) {
	return pget(
		`${modalApi.carMessage}/assetsaccidentdataprocessing/carPage`,
		query,
	)
}

// 车辆详情获取滴滴订单
export function getOrderList(data: any) {
	return ppostJson(`${modalApi.carMessage}/vehicle/getOrderList`, data)
}

// 根据车辆id获取违章记录
export function getCarViolationList(data: any) {
	return ppostJson(`${modalApi.carMessage}/vehicle/getCarViolationList`, data)
}

// 根据车辆id获取年检信息
export function getMotList(query?: any) {
	return pget(`${modalApi.carMessage}/vehicle/getMotList`, query)
}

// 根据车辆id获取气瓶检信息
export function getGasList(query?: any) {
	return pget(`${modalApi.carMessage}/vehicle/getGasList`, query)
}

// 根据车架号获取设备信息
export function getDeviceList(data: any) {
	return ppostJson(`${modalApi.carMessage}/vehicle/getDeviceList`, data)
}

// 车辆图片导入
export function importBatchImg(data: any) {
	return ppostJson(`${modalApi.carMessage}/vehicle/car-img/import`, data)
}

// 车辆详情获取代运营信息
export function getOperationInfo(query?: any) {
	return pget(`${modalApi.carMessage}/vehicle/getOperationInfo`, query)
}

// 获取车辆颜色，座椅材质等字典信息
export function getDictInfo(query?: any) {
	return pget(`${modalApi.carMessage}/vehicle/getDictInfo`, query)
}
// 更新车辆状态
export function updateStatus(data: any) {
	return ppostJson(`${modalApi.carMessage}/vehicle/updateStatus`, data)
}
// 车辆同步接口
export function syncData(data: any) {
	return ppostJson(`${modalApi.carMessage}/vehicle/sync`, data)
}

// 分页 - 获取车辆的盘点信息
export function getStocktakePage(query?: any) {
	return pget(`${modalApi.carMessage}/stocktake/car/stocktake-page`, query)
}